package org.amicofragile.ordering

class Person(name : String) extends Ordered {
	def < (o: Any) : Boolean = {
		if(!o.isInstanceOf[Person])
			error("Cannot compare " + o + " and a Person")
		
		val that = o.asInstanceOf[Person]
		name.compareTo(that.name) < 0
	}
	
	def pp (that:Person) : Person = {
		val newName : String = name + that.name
		new Person(newName)
	}
	
	def name() : String = name
}